﻿<%@ Application Language="VB" %>

<script runat="server">

    Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
        ' Code that runs on application startup
    End Sub
    
    Sub Application_End(ByVal sender As Object, ByVal e As EventArgs)
        ' Code that runs on application shutdown
    End Sub
        
    Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
        ' Code that runs when an unhandled error occurs
    End Sub

    Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs)
        'sesion para el cliente cuando se loguee
        Session("cliente") = ""
        
        ' x mientras esta sera la session para el carrito
        Dim tb As New Data.DataTable
        tb.Columns.Add("codEqui", Type.GetType("System.Int32"))
        tb.Columns.Add("modelo", Type.GetType("System.String"))
        tb.Columns.Add("color", Type.GetType("System.String"))
        tb.Columns.Add("codOpe", Type.GetType("System.Int32"))
        tb.Columns.Add("precio", Type.GetType("System.Double"))
        tb.Columns.Add("cantidad", Type.GetType("System.Int32"))
        tb.Columns.Add("monto", Type.GetType("System.Double"), "precio*cantidad")
        
        'definir la llave primaria
        tb.PrimaryKey = New Data.DataColumn() {tb.Columns(0)}
        
        Session("carrito") = tb
        
    End Sub

    Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)
        ' Code that runs when a session ends. 
        ' Note: The Session_End event is raised only when the sessionstate mode
        ' is set to InProc in the Web.config file. If session mode is set to StateServer 
        ' or SQLServer, the event is not raised.
        Session().Abandon()
    End Sub
       
</script>